import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import City from '@/views/City'
import Layout from '@/views/Layout'

import List from '@/views/List'
import Profile from '@/views/Profile'
import News from '@/views/News'
import Detail from '@/views/Detail'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/Detail/:keywords',
    component: Detail
  },
  {
    path: '/city',
    component: City
  },
  {
    path: '/home',
    component: Layout,
    children: [
      {
        path: 'list',
        component: List,
        meta: {
          name: 'list'
        }
      },
      {
        path: '',
        component: Home,
        meta: {
          name: 'home'
        }
      },
      {
        path: 'profile',
        component: Profile,
        meta: {
          name: 'profile'
        }
      },
      {
        path: 'news',
        component: News,
        meta: {
          name: 'news'
        }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
